home *** CD-ROM | disk | FTP | other *** search
/ Aminet 40 / Aminet 40 (2000)(Schatztruhe)[!][Dec 2000].iso / Aminet / dev / basic / PureBasic_Upd.lha / PureBasic_Update1.60 / PureBasic / Examples / Sources / Picture.pb < prev    next >
Encoding:
Text File  |  2000-09-10  |  1.3 KB  |  68 lines

  1. ;
  2. ; ***********************************
  3. ;
  4. ; Picture example file for Pure Basic
  5. ;
  6. ;    © 1999 - Fantaisie Software -
  7. ;
  8. ; ***********************************
  9. ;
  10. ;
  11.  
  12. InitPicture(0)
  13. InitRequester()
  14. InitBitMap(0)
  15. InitScreen(0)
  16. InitWindow(0)
  17. InitPalette(2)
  18.  
  19. FindScreen(0,"Workbench")
  20. ShowScreen()
  21.  
  22. PrintN("Choose a picture...")
  23.  
  24. FileName$ = FileRequester(0)
  25.  
  26. If FileName$ <> ""
  27.   res.l = LoadPicture(0,FileName$)
  28.  
  29.   If res>0
  30.  
  31.     PrintN ("Picture information: "+Str(PictureWidth())+"*"+Str(PictureHeight())+"*"+Str(PictureDepth()))
  32.  
  33.     AllocateBitMap (0, PictureWidth(), PictureHeight(), PictureDepth())
  34.  
  35.     PictureToBitMap(0, BitMapID())
  36.  
  37.     GetScreenPalette(0, ScreenID())
  38.  
  39.     CreatePalette (2,1 LSL ScreenDepth())            ; Put the display black
  40.     DisplayPalette(2, ScreenID())   ;
  41.  
  42.     If OpenWindow (0, 0, 0, ScreenWidth(), ScreenHeight(), #WFLG_BORDERLESS, 0)
  43.  
  44.       DrawingOutput(WindowRastPort())
  45.  
  46.       GetPicturePalette (1, PictureID())
  47.  
  48.       x.w = (ScreenWidth()  - PictureWidth() )/2
  49.       y.w = (ScreenHeight() - PictureHeight())/2
  50.  
  51.       If x<0 : x=0 : EndIf
  52.       If y<0 : y=0 : EndIf
  53.  
  54.       DisplayPalette(1, ScreenID())
  55.  
  56.       CopyBitMap(BitMapID(),0,0,x,y,PictureWidth(), PictureHeight())
  57.  
  58.       MouseWait()
  59.  
  60.     EndIf
  61.  
  62.     DisplayPalette (0, ScreenID())
  63.  
  64.   EndIf
  65. Endif
  66.  
  67. End
  68.